package com.gr.staffpm.projects.model;

import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import com.gr.staffpm.datatypes.Project;
import com.gr.staffpm.pages.projects.ViewProject;


public class ProjectLink extends Link<Project> {

    /**
     * @param id
     * @param model
     * @see org.apache.wicket.Component#Component(String, IModel)
     */
    public ProjectLink(final String id, IModel<Project> model) {
        super(id, model);
    }

    /**
     * @param id
     * @param project
     */
    public ProjectLink(String id, Project project) {
        super(id, new Model<Project>(project));
    }

    private static final long serialVersionUID = 1L;

    @Override
    public void onClick() {
        setResponsePage(new ViewProject(new PageParameters("id=" + String.valueOf(getModelObject().getProjectId()))));
    }

}
